package com.example.fragment.tool;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.fragment.R;


public class LogbuttonLayout extends LinearLayout {
    public ImageView mIvPicture;
    private LinearLayout mlayout;
    private String username,usernumber;
    public TextView mTvUsername,mTvUserNumber;
    public LogbuttonLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.layout_loginbuttn,this);
       mIvPicture=findViewById(R.id.iv_picture);
       mTvUsername =findViewById(R.id.tv_username);
        mTvUserNumber =findViewById(R.id.tv_usernumber);
        if(!TextUtils.isEmpty(username)){
            mTvUsername.setText(username);
            System.out.println("数据传递进来了");
        }
        if(!TextUtils.isEmpty(usernumber)){
            mTvUserNumber.setText(usernumber);
        }
    }
    public ImageView getmIvPicture() {
        return mIvPicture;
    }
//有可能有问题
    public LogbuttonLayout setmIvPicture(int picture) {
        this.mIvPicture.setImageResource(picture);
        return this;
    }

    public TextView getmTvUsername() {
        return mTvUsername;
    }
   public void setbackground(int background){
       mlayout =findViewById(R.id.ly_backgrond);
       mlayout.setBackgroundResource(background);
   }
    public LogbuttonLayout setmTvUsername(String username) {
        this.username = username;
        return this;
    }

    public TextView getmTvUserNumber() {
        return mTvUserNumber;
    }

    public LogbuttonLayout setmTvUserNumber(String usernumber) {
        this.usernumber = usernumber;
        return this;
    }

}
